﻿using COC.Constant;
using COC.UIAction;
using UnityEngine;
using System.Collections;

namespace COC.UIAction
{

public class LoadAction : BaseAction {

    UISlider progressing;
    AsyncOperation async;
    public string scene = CommonConstants.CAMPS_SCENE;
	// Use this for initialization
	void Start () {
        progressing=GameObject.Find(CommonConstants.LOAD_PROGRESSING_UI_PROGRESS).transform.GetComponent<UISlider>();

        async = Application.LoadLevelAsync(scene);
	}
	
	// Update is called once per frame
	void Update () {
        if (!async.isDone)
        {
            progressing.value = async.progress;

        }
        if (progressing.value==1)
        {
            async.allowSceneActivation = true;
        }
        else
        {
            progressing.value++; 
        }
	}
}

}
